import {createApp} from 'vue'
import router from './router'
import App from './App.vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import {createI18n} from 'vue-i18n';
import en from "./assets/language/en.js";
import zh from "./assets/language/zh.js";
import DataVVue3 from '@kjgl77/datav-vue3'
import {createPinia} from "pinia";
import {createPersistedState} from "pinia-persistedstate-plugin";
import {zhCn} from "element-plus/es/locale/index";
const pinia = createPinia()
const persist=createPersistedState()
pinia.use(persist)
//组合语言包
const messages = {
    en,
    zh
}
const i18n = createI18n({
    legacy: false,  // 设置为 false，启用 composition API 模式
    messages,
    locale: 'zh'  // 设置默认语言
})
// 路由跳转后回到顶部
router.afterEach((to, from, next) => {
    window.scrollTo(0, 0);
})
createApp(App)
    .use(DataVVue3)
    .use(pinia)
    .use(i18n)
    .use(router)
    .use(ElementPlus, { locale: zhCn })
    .mount('#app')
